Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix type of methods in query-interface #11582

Merged

Conversation

2kindsofcs
Copy link
Contributor

Pull Request check-list

Please make sure to review and check all of these items:

  • Does npm run test or npm run test-DIALECT pass with this change (including linting)?
    (npm run test-typings, actaully)
  • Does the description below contain a link to an existing issue (Closes #[issue]) or a description of the issue you are solving?
  • Have you added new tests to prevent regressions?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Did you update the typescript typings accordingly (if applicable)?
  • Did you follow the commit message conventions explained in CONTRIBUTING.md?

Description of change

as described in #11027, many of the QueryInterface methods accept something like string | { tableName: string, schema: string } as the first argument. however, they are accepting tableName with string type only. So I added interface and type so that they could get arguments other than string.

@papb
Copy link
Member

papb commented Oct 19, 2019

Hi, thanks for the PR, can you please add more tests?

@@ -120,6 +120,15 @@ export interface QueryInterfaceDropAllTablesOptions extends QueryInterfaceOption
skip?: string[];
}

export interface TablenameWithSchema {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably be TableName.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean it should be TableName or TableNameWithSchema?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

He probably means TableNameWithSchema

@codecov
Copy link

codecov bot commented Oct 20, 2019

Codecov Report

Merging #11582 into master will decrease coverage by 3.79%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #11582     +/-   ##
=========================================
- Coverage   96.26%   92.47%   -3.8%     
=========================================
  Files          94       91      -3     
  Lines        9190     8903    -287     
=========================================
- Hits         8847     8233    -614     
- Misses        343      670    +327
Impacted Files Coverage Δ
lib/dialects/sqlite/query-generator.js 2.91% <0%> (-93.69%) ⬇️
lib/dialects/sqlite/query-interface.js 15.62% <0%> (-84.38%) ⬇️
lib/dialects/sqlite/data-types.js 35.89% <0%> (-64.11%) ⬇️
lib/errors/database/timeout-error.js 40% <0%> (-60%) ⬇️
lib/query-interface.js 88.78% <0%> (-3.42%) ⬇️
lib/transaction.js 97.33% <0%> (-2.67%) ⬇️
lib/sequelize.js 94.68% <0%> (-1.25%) ⬇️
lib/dialects/abstract/query.js 91.02% <0%> (-0.97%) ⬇️
lib/dialects/abstract/query-generator.js 96.5% <0%> (-0.52%) ⬇️
lib/data-types.js 91% <0%> (-0.35%) ⬇️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update edac3e9...22d6a62. Read the comment docs.

@2kindsofcs
Copy link
Contributor Author

@papb hi. I added some tests. I was wondering if you think there should be more tests.

as?: string;
name?: string;
}
export type Tablename = string | TablenameWithSchema;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export type Tablename = string | TablenameWithSchema;
export type TableName = string | TableNameWithSchema;

@papb
Copy link
Member

papb commented Oct 21, 2019

@2kindsofcs Thanks, I think those tests are enough now.

@papb papb added status: awaiting response For issues and PRs. OP must respond (or change something, if it is a PR). Maintainers have no action type: typescript For issues and PRs. Things that involve typescript, such as typings and intellisense. labels Oct 21, 2019
@papb papb added status: awaiting maintainer and removed status: awaiting response For issues and PRs. OP must respond (or change something, if it is a PR). Maintainers have no action labels Oct 22, 2019
@sushantdhiman sushantdhiman merged commit c77c553 into sequelize:master Oct 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: typescript For issues and PRs. Things that involve typescript, such as typings and intellisense.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants